﻿using System;

namespace EOrm
{
    /// <summary>
    /// 数据表构建类
    /// </summary>
    public abstract class TableBuilder
    {
        /// <summary>
        /// 数据表的实体类型
        /// </summary>
        protected Type _tableType = null;

        /// <summary>
        /// 数据表的实体类型
        /// </summary>
        public Type TableType
        {
            get
            {
                if (_tableType == null)
                {
                    _tableType = SetType();
                }
                return _tableType;
            }
        }

        /// <summary>
        /// 设定数据表的实体类型
        /// </summary>
        /// <returns></returns>
        public abstract Type SetType();

        /// <summary>
        /// 构建数据表
        /// </summary>
        /// <param name="table">要构建的数据表</param>
        public abstract void Build(ITable table);
    }
}
